import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue', 'vue-router', 'pinia']
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    host: '10.159.12.208',
    port: 80,
    open: true,
    proxy: {
      "^/api/": {
        target: "http://localhost:8080/", // 后台服务器地址
        changeOrigin: true /* 允许跨域 */,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    }
  }
})
